//
//  Marco.h
//  TestPrj
//
//  Created by 朱铅峰 on 2019/12/9.
//  Copyright © 2019 Xing. All rights reserved.
//

#define WEAKSELF __weak typeof(self) weakSelf = self;

#define LocalStr(string) NSLocalizedString(string, @"")

#define proCopy   @property(nonatomic, copy)
#define proCopyString @property(nonatomic, copy) NSString *
#define proStrong @property(nonatomic, strong)
#define proAssign @property(nonatomic, assign)
#define proWeak @property(nonatomic, weak)

#define RGB(r,g,b) ([UIColor colorWithRed:r green:g blue:b alpha:1]) //色值为小数
#define RGB_INT(r,g,b) ([UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]) //色值为正整数

#define kColorBlack RGB_INT(51, 51, 51) //黑色
#define kColorGray RGB_INT(102, 102, 102) //灰色
#define kColorLightGray RGB_INT(153, 153, 153) //浅灰色
#define kColorLineColor RGB(0.9, 0.9, 0.9) //线条颜色
#define kColorBgColor RGB(0.95, 0.96, 0.97) //默认的深色背景颜色
#define kColorTfPlaceholderColor RGB(0.75,0.75,0.75) //输入框提示文本颜色

#define kScreenWidth [[UIScreen mainScreen] bounds].size.width
#define kScreenHeight [[UIScreen mainScreen] bounds].size.height
#define kScreenSize [[UIScreen mainScreen] bounds].size
#define kIsIphoneX ((int)((kScreenHeight/kScreenWidth)*100) == 216)
#define kStatusBarHeight (kIsIphoneX ? 44 : 20)
#define kNavBarWithoutStatusHeight 44
#define kNavBarHeight (kStatusBarHeight + kNavBarWithoutStatusHeight)
#define kTabBarBarHeight (kIsIphoneX ? 83 : 49)
#define kTabBarBarContentHeight 49

#define kDefaultNavBar_SubView_MinY (kIsIphoneX ? 24.0 : 0.0)//导航条子视图默认最小Y坐标
#define IPHONE_SAFEBOTTOMAREA_HEIGHT (kIsIphoneX ? 34 : 0)
#define IPHONE_TOPSENSOR_HEIGHT      (kIsIphoneX ? 32 : 0)


#define kDocumentPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
#define kCachePath [NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES) firstObject]

/**
 Synthsize a weak or strong reference.
 
 Example:
 @weakify(self)
 [self doSomething^{
 @strongify(self)
 if (!self) return;
 ...
 }];
 
 */
#ifndef weakify
#if DEBUG
#if __has_feature(objc_arc)
#define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
#endif
#else
#if __has_feature(objc_arc)
#define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
#endif
#endif
#endif

#ifndef strongify
#if DEBUG
#if __has_feature(objc_arc)
#define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
#endif
#else
#if __has_feature(objc_arc)
#define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
#endif
#endif
#endif
